home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / lib / xfopena.c < prev    next >
C/C++ Source or Header  |  1992-05-05  |  399b  |  22 lines

  1. /*  $Revision: 1.1 $
  2. **
  3. */
  4. #include <stdio.h>
  5. #include <fcntl.h>
  6.  
  7.  
  8. /*
  9. **  Open a file in append mode.  Since not all fopen's set the O_APPEND
  10. **  flag, we do it by hand.
  11. */
  12. FILE *
  13. xfopena(p)
  14.     char    *p;
  15. {
  16.     int        fd;
  17.  
  18.     /* We can't trust stdio to really use O_APPEND, so open, then fdopen. */
  19.     fd = open(p, O_WRONLY | O_APPEND | O_CREAT, 0666);
  20.     return fd >= 0 ? fdopen(fd, "a") : NULL;
  21. }
  22.